package model.dao;

import java.util.ArrayList;

import model.bean.Nucleo;

import org.hibernate.Query;

public class NucleoDao extends GenericDao<Nucleo> {

	public NucleoDao() {
		super(Nucleo.class);
	}

	public Nucleo validarDescricao(Nucleo nucleo) {
		Query query = getSession().getNamedQuery("findByDescricao");
		query.setMaxResults(1);
		query.setString("descricao", nucleo.getDescricao());
		return (Nucleo) query.uniqueResult();
	}	
	

	@SuppressWarnings("unchecked")
	public ArrayList<Nucleo> findByDescricao(String descricao) {
		Query query = getSession().getNamedQuery("findByDescricaoPesquisa");
		query.setString("descricao", descricao);
		return (ArrayList<Nucleo>) query.list();
	}



}
